Ext.define('joydeep.view.LineChart', {
    extend: 'Ext.chart.Chart',
    alias : 'widget.linechart',
   // id : '',
   // layout: 'border',
  //  autoScroll : true,
   store : null,
   data : null,
   linechartObject : null,
    initComponent: function() {
      //  alert("initComponent : " + this.linechartObject);
        
       // alert("linechartObject " + this.linechartObject);
		var data1 = this.linechartObject["data"]; 
		//alert("data " + data1);
		//var fields1 = this.linechartObject["fields"];
		//alert("fields : " +fields1);
		//var xaxesTitle = this.linechartObject["xaxesTitle"];
		//alert("xaxesTitle = "+ xaxesTitle);
		//var yaxesTitle = this.linechartObject["yaxesTitle"];
		//alert("yaxesTitle = "+ yaxesTitle);
		
		var axesConfig = this.linechartObject["axesConfig"];
		//alert("axesConfig "+ axesConfig);
       // alert("xField " + axesConfig.xField);
       // alert("yField " + axesConfig.yField);
       // alert("xFieldLabel " + axesConfig.xFieldLabel);
       // alert("yFieldLabel " + axesConfig.yFieldLabel);
		
		
//		var series1 = {
//			type: 'line',
//			axis: 'left',
//		    xField: axesConfig.xField, 
//		    yField: axesConfig.yField,
//		    tips: {
//		        trackMouse: true,
//		        width: 150,
//		        height: 30,
//		        renderer: function(storeItem, item) {
//		            this.setTitle(axesConfig.xFieldLabel + " : " + storeItem.get('name') +' ' + axesConfig.yFieldLabel + ' :' + storeItem.get('value'));
//		           // this.setTitle("{0}% Profit in {1}",storeItem.get('value'), storeItem.get('name') );
//		        }
//		    }
//		};
               
    	Ext.apply(this,{
    			width: 500,
			    height: 300,
			    animate: true,
			    store: Ext.create('Ext.data.JsonStore', {
					fields: [axesConfig.xField, axesConfig.yField],
//					fields : fields1,
			    	//fields: ['name', 'value'],
					data: data1
				}),
			    axes: [
			        {
			            type: 'Numeric',
			            position: 'left',
			            fields: [axesConfig.yField],
			            label: {
			                renderer: Ext.util.Format.numberRenderer('0,0')
			            },
			            title: axesConfig.yFieldLabel,
			            grid: true,
			            minimum: 0
			        },
			        {
			            type: 'Category',
			            position: 'bottom',
			            fields: [axesConfig.xField],
			            title: axesConfig.xFieldLabel
			        }
			    ],
			    series: [
			        {
			            type: 'line',
//			            highlight: {
//			                size: 7,
//			                radius: 7
//			            },
			            axis: 'left',
			            xField: axesConfig.xField,
			            yField: axesConfig.yField,
			            tips: {
		                    trackMouse: true,
		                    width: 150,
		                    height: 30,
		                    renderer: function(storeItem, item) {
		                        this.setTitle(axesConfig.xFieldLabel + " : " + storeItem.get('name') +' ' + axesConfig.yFieldLabel + ' :' + storeItem.get('value'));
		                       // this.setTitle("{0}% Profit in {1}",storeItem.get('value'), storeItem.get('name') );
		                    }
		                }//,
//			            markerConfig: {
//			                type: 'cross',
//			                size: 2,
//			                radius: 2,
//			                'stroke-width': 0
//			            }
			        }
			    ]
			   // series : [series1]
        	
        });
       
        this.callParent(arguments);
    },
    
    getStore : function(){
    	return this.store;
    }
	
});


